//
//  ROPicScrollView.h
//  Runone
//
//  Created by runone02 on 16/11/19.
//  Copyright © 2016年 runone. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "ROPicItem.h"
#import "ROPicItemConfiguration.h"
#import "NSTimer+Control.h"
#import "ROPicScrollViewConfiguration.h"


@class ROPicScrollView;


@protocol ROPicScrollViewDataSource <NSObject>

@required

- (NSUInteger)numberOfItemsInPicScrollView:(ROPicScrollView *)picScrollView;

- (void)picScrollView:(ROPicScrollView *)picScrollView
       needUpdateItem:(ROPicItem *)item
              atIndex:(NSInteger)index;

@end

@protocol ROPicScrollViewDelegate <NSObject>

@optional

- (void)picScrollView:(ROPicScrollView *)picScrollView
           selectItem:(ROPicItem *)item
              atIndex:(NSInteger)index;

@end


@interface ROPicScrollView : UIView


@property (nonatomic,weak) id<ROPicScrollViewDataSource> dataSource;

@property (nonatomic,weak) id<ROPicScrollViewDelegate> delegate;

@property (nonatomic,readonly) NSUInteger currentIndex;

@property (nonatomic,strong,readonly) NSTimer *timer;


//if you not set Configuration,will use defaultConfiguration

+ (instancetype)picScrollViewWithFrame:(CGRect)frame
                     withConfiguration:(ROPicScrollViewConfiguration *)configuration
                        withDataSource:(id<ROPicScrollViewDataSource>)dataSource;

+ (instancetype)picScrollViewWithFrame:(CGRect)frame
                        withDataSource:(id<ROPicScrollViewDataSource>)dataSource;

- (instancetype)initWithFrame:(CGRect)frame
               withDataSource:(id<ROPicScrollViewDataSource>)dataSource;

- (instancetype)initWithFrame:(CGRect)frame
            withConfiguration:(ROPicScrollViewConfiguration *)configuration
               withDataSource:(id<ROPicScrollViewDataSource>)dataSource;

- (void)removeTimer;

- (void)reloadData;

@end
